package com.boxuegu.caihuaxuan24.myapplication.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.boxuegu.caihuaxuan24.myapplication.R;
import com.boxuegu.caihuaxuan24.myapplication.activity.LoginActivity;

public class myFragment extends Fragment {
    ImageView head;
    String token;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_my, container, false);
        head = view.findViewById(R.id.head);
        SharedPreferences sharedPreferences = getActivity().getSharedPreferences("boxuegu", Context.MODE_PRIVATE);
        token = sharedPreferences.getString("token","");
        if (token.length() > 0 ) {

        }
        Log.i("MyFragment",token);
        head.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (token.length()>0){
                }else {
                    Intent intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                }
            }
        });
        return view;
    }

}

